package com.my.hp_hr.service.liuhao_service;

import com.my.hp_hr.dao.liuhao_dao.EmployeeDao;
import com.my.hp_hr.entity.liuhao_entity.Department;
import com.my.hp_hr.entity.liuhao_entity.Employee;
import com.my.hp_hr.entity.liuhao_entity.Position;

public class EmployeeService {
    public EmployeeDao dao=new EmployeeDao();
    public Employee checkEmployeeByNumAndPassword(String number, String password) throws Exception {
        return dao.checkEmployeeByNumAndPassword(number,password);
    }

    public Employee selectemployeedetail(int id) throws Exception {
        Employee employee = dao.selectemployeedetail(id);
        Position position = dao.selectpositiondetailByPosition_number(employee.getPosition_number());
        Department department = dao.selectdepartmentdetailByPosition_number(employee.getDepartment_number());
        employee.setPosition(position);
        employee.setDepartment(department);
        return employee;
    }

    public void updateEmployeeInfo(Employee employee) throws Exception {
        dao.updateEmployeeInfo(employee);
    }
}
